export default {
  // Target: https://go.nuxtjs.dev/config-target
  target: 'static',

  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: 'my website title',
    htmlAttrs: {
      lang: 'en'
    },
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' },
      { name: 'format-detection', content: 'telephone=no' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    'ant-design-vue/dist/antd.css'
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    '@/plugins/antd-ui'
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
  ],

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    // 配置 按需加载功能 需 babel-plugin-import 支持
    transpile: ['ant-design-vue'],
    babel: {
      plugins: [
        [
          'import',
          {
            libraryName: 'ant-design-vue',
            libraryDirectory: 'es',
            style: 'css' // 如果需要使用 less 方式去按需加载的话，则需要改为 true ，并且添加下面loaders 配置
          },
          'ant-design-vue'
        ]
      ]
    },
    // 此处是 style 为 true 时所需添加的配置
    loaders: {
      less: {
        lessOptions: {
          javascriptEnabled: true,
          // modifyVars 可用来自定义主题
          modifyVars: {
            'primary-color': '#41b883',
            'layout-body-background': '#fff'
          }
        }
      }
    },
    // 代码检测
    extend(config, ctx) {
      // Run ESLint on save
      if (ctx.isDev && ctx.isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/,
          options: {
            fix: true
          }
        })
      }
    }
  },

  // 如果此选项设置为 true，则尾部斜杠将附加到每条路线。如果设置为 false，它们将被删除。
  // router: {
  //   trailingSlash: true
  // }

  // Customizing the Progress Bar 自定义进度条
  loading: {
    color: 'blue',
    height: '5px'
  }
}
